<?php
    
  $aux = explode ( '|', isset($_GET['id']) ? $_GET['id'] : '' );
  $EvaluationUid = str_replace ( '"', '', $aux[0] );
  
  require_once ( PATH_PLUGINS . 'hr' . PATH_SEP . 'class.hr.php');
  $pluginObj = new hrClass ();

  require_once ( "classes/model/HrEvaluations.php" );
  //if exists the row in the database propel will update it, otherwise will insert.
  $tr = HrEvaluationsPeer::retrieveByPK( $EvaluationUid  );
  
  if ( ( is_object ( $tr ) &&  get_class ($tr) == 'HrEvaluations' ) ) { 
     $fields['EVALUATION_UID'] = $tr->getEvaluationUid();
     $fields['EMPLOYEE_ID'] = $tr->getEmployeeId();
     $fields['REVIEWCOMMENTS'] = $tr->getReviewcomments();
     $fields['REVIEWER'] = $tr->getReviewer();
     $fields['DATECOMPLETED'] = $tr->getDatecompleted();
     $fields['DATEDUE'] = $tr->getDatedue();
     $fields['DATEOFNEXTEVALUATION'] = $tr->getDateofnextevaluation();
     $fields['ATTACHEMENT'] = $tr->getAttachement();
  }
  else
    $fields = array();  
  
  $G_MAIN_MENU = 'processmaker';
  $G_SUB_MENU = 'hr/menuhrEmployee';
  $G_ID_MENU_SELECTED = 'ID_HR_EMP';
  $G_ID_SUB_MENU_SELECTED = 'ID_HR_EVALUATIONS';


  $G_PUBLISH = new Publisher;
  $G_PUBLISH->AddContent('xmlform', 'xmlform', 'hr/hrEvaluationsEdit', '', $fields, 'hrEvaluationsSave' );
  G::RenderPage('publish', 'blank');   
?>